package com.zrrd.learn.chapter04;

import java.util.Arrays;

/**
 * 学习一下数组
 *
 * @author wrn
 * @version 1.0
 * @date 2023/5/27 15:25
 */

public class LearnArray01 {

    public static void main(String[] args) {
        Dog d = new Dog();
        d.setName("孙宝贵");

        Dog d1 = new Dog();
        d1.setName("王春花");

        d1=d;

        //
        Dog[] dogs = new  Dog[]{d1,d};

        System.out.println(dogs[0] == d1);

        System.out.println(d == d1);

        int[] a = new int [10];

//        a[0] = 3;
//        a[1] = 5;
//        a[2] = 7;
//        a[3] = 9;
//        a[4] = 11;
//        a[5] = 13;
//        a[6] = 15;
//        a[7] = 17;
//        a[8] = 19;
//        a[9] = 21;
        for (int i = 1,b=0; b<10 ;b++){
            a[b] = i+=2;
        }
        System.out.println(Arrays.toString(a));

        for (int i = 0; i < a.length; i++){
            while(true){
                int v = (int)(Math.random() * 98+3);
                if(v%2!=0){
                    a[i] =v;
                    break;
                }
            }
        }
        System.out.println(Arrays.toString(a));
    }
}
